<?php

/**
 * Created by PhpStorm.
 * User: Joe
 * Date: 2015/9/18
 * Time: 14:37
 */
class Admin_BaseController extends  Zend_Controller_Action{
    public function init(){
        //初始化数据库配置
        $url = constant("APPLICATION_PATH").DIRECTORY_SEPARATOR.'configs'.DIRECTORY_SEPARATOR.'application.ini';
        $dbconfig = new Zend_Config_Ini($url,"mysql");//读取配置文件中的mysql区块[mysql]
        $db = Zend_Db::factory($dbconfig->db);//初始化数据库工厂
        $db->query("set names utf8");//设置
        Zend_Db_Table::setDefaultAdapter($db);
    }
}
